package io.github.bloquesoft.entity.storage.finding;

import lombok.Getter;

import java.util.Collections;
import java.util.LinkedList;
import java.util.List;

public class PropertyTreeNode
{
    @Getter
    private final String propertyName;

    @Getter
    private final List<PropertyTreeNode> children;

    public PropertyTreeNode addChild(String propertyName)
    {
        PropertyTreeNode node = new PropertyTreeNode(propertyName);
        this.children.add(node);
        return node;
    }

    public PropertyTreeNode(String propertyName, PropertyTreeNode... childNodes) {
        this.propertyName = propertyName;
        this.children = new LinkedList<>();
        Collections.addAll(this.children, childNodes);
    }
}
